﻿/*
 
Celerity: Sensory Overload
Copright 2012 by Adam Hill, David Gannon, Thomas Tamblyn & Patrick Ytting
Contact: adam.hill@outlook.com
Website: adamhill.org
Licence: MS-Pl Licence
  
 */

using Celerity.ColourPalette;
using Celerity.Content;
using Celerity.Data;
using Microsoft.Xna.Framework;

namespace Celerity.UI
{
    public partial class UILayer
    {
        public void Draw(bool displayMouse)
        {
            drawCounter++;
            DrawWebcamFaceBlob();
            DrawControls();
            DrawFPSText();
            if (displayMouse)
            {
                DrawMouse();
            }
        }

        void DrawWebcamFaceBlob()
        {
            if (GlobalGameStates.GameState != GameState.Menu || GlobalGameStates.MenuState != MenuState.MainMenu)
            {
                return;
            }

            if (GlobalGameStates.CameraState == CameraState.NoCamera || GlobalGameStates.CameraState == CameraState.Override)
            {
                return;
            }

            spriteBatch.Draw(ImageLibrary.FaceBlob, calibratorFaceBlob, Color.White);
        }

        void DrawControls()
        {
            controls.Draw(spriteBatch);
        }

        void DrawFPSText()
        {
            if (!CeleritySettings.TestMode)
            {
                return;
            }

            spriteBatch.DrawString(FontLibrary.Standard, fpsText, fpsTextPos, Palette.SecondaryAccent);
        }

        void DrawMouse()
        {
            spriteBatch.Draw(ImageLibrary.Mouse, mouse, Color.White);
        }
    }
}
